package zkk.com.mengqu.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import zkk.com.mengqu.R;
import zkk.com.mengqu.activity.CircleFriendArticleActivity;
import zkk.com.mengqu.activity.CircleFriendArticleListActivity;

/**
 * 饭友页面适配器
 */
public class CircleFriendAdapter extends BaseAdapter {

    private Context context;
    public CircleFriendAdapter( Context con) {
        this.context=con;
    }

    @Override
    public int getCount() {
//        return paints==null?0:paints.size();
        return 10;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }



    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {

        ViewHolder holder;
            if(convertView == null){
                holder = new ViewHolder();
                convertView = LayoutInflater.from(context).inflate(R.layout.item_circle_friend,null);
                convertView.setTag(holder);
            }else {
                holder = (ViewHolder) convertView.getTag();
            }

        holder.rlArticle = (RelativeLayout)convertView.findViewById(R.id.rl_article);
        holder.username = (TextView)convertView.findViewById(R.id.tx_user_name);

        holder.rlArticle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context , CircleFriendArticleActivity.class));
            }
        });

        holder.username.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                context.startActivity(new Intent(context , CircleFriendArticleListActivity.class));
            }
        });

        return convertView;
    }

    class ViewHolder{
        private RelativeLayout rlArticle;
        private TextView username;
    }

}
